package view;

import javax.swing.JPanel;
import java.awt.Dimension;
import javax.swing.JLabel;
import java.awt.FlowLayout;
import javax.swing.JTextField;
import javax.swing.JButton;
import java.awt.GridBagLayout;
import java.awt.GridBagConstraints;
import javax.swing.BoxLayout;
import java.awt.GridLayout;

public class NewBookingDisplay extends JPanel {

	private static final long serialVersionUID = 1L;
	private JLabel jLabel = null;
	private JTextField jTextFieldResource = null;
	private VControler vControler;
	private JPanel jPanel1 = null;
	private JPanel jPanel2 = null;
	private JLabel jLabel1 = null;
	private JTextField jTextFieldDescription = null;
	private JPanel jPanel6 = null;
	private JPanel jPanel3 = null;
	private JPanel jPanel21 = null;
	private JPanel jPanel31 = null;
	private JLabel jLabel2 = null;
	private JTextField jTextFieldSign = null;
	private JPanel jPanel22 = null;
	private JPanel jPanel32 = null;
	private JLabel jLabel3 = null;
	private JTextField jTextFieldDate = null;
	private JPanel jPanel23 = null;
	private JPanel jPanel33 = null;
	private JLabel jLabel4 = null;
	private JTextField jTextFieldTime = null;
	private JPanel jPanel11 = null;
	private JPanel jPanel61 = null;
	private JPanel jPanel = null;
	private JButton jButton = null;
	/**
	 * This is the default constructor
	 */
	public NewBookingDisplay() {
		super();
		initialize();
	}

	public NewBookingDisplay(VControler controler) {
		super();
		initialize();
		this.vControler = controler; 
	}

	/**
	 * This method initializes this
	 * 
	 * @return void
	 */
	private void initialize() {
		jLabel = new JLabel();
		jLabel.setText("resurs");
		this.setSize(623, 305);
		this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
		this.add(getJPanel1(), null);
		this.add(getJPanel2(), null);
		this.add(getJPanel21(), null);
		this.add(getJPanel22(), null);
		this.add(getJPanel23(), null);
		this.add(getJPanel11(), null);
		this.add(getJPanel(), null);
		this.validate();
	}

	/**
	 * This method initializes jTextFieldResource	
	 * 	
	 * @return javax.swing.JTextField	
	 */
	private JTextField getJTextFieldResource() {
		if (jTextFieldResource == null) {
			jTextFieldResource = new JTextField();
			jTextFieldResource.setPreferredSize(new Dimension(200, 20));
			jTextFieldResource.setText("");
		}
		return jTextFieldResource;
	}

	public void showNewbookingDisplay(){

	}

	/**
	 * This method initializes jPanel1	
	 * 	
	 * @return javax.swing.JPanel	
	 */
	private JPanel getJPanel1() {
		if (jPanel1 == null) {
			FlowLayout flowLayout1 = new FlowLayout();
			flowLayout1.setAlignment(FlowLayout.LEFT);
			flowLayout1.setHgap(5);
			flowLayout1.setVgap(0);
			jLabel1 = new JLabel();
			jLabel1.setText("beskrivning");
			jPanel1 = new JPanel();
			jPanel1.setLayout(flowLayout1);
			jPanel1.setPreferredSize(new Dimension(130, 30));
			jPanel1.add(getJPanel6(), null);
			jPanel1.add(getJTextFieldDescription(), null);
		}
		return jPanel1;
	}

	/**
	 * This method initializes jPanel2	
	 * 	
	 * @return javax.swing.JPanel	
	 */
	private JPanel getJPanel2() {
		if (jPanel2 == null) {
			FlowLayout flowLayout2 = new FlowLayout();
			flowLayout2.setAlignment(FlowLayout.LEFT);
			flowLayout2.setVgap(0);
			jPanel2 = new JPanel();
			jPanel2.setLayout(flowLayout2);
			jPanel2.setPreferredSize(new Dimension(130, 30));
			jPanel2.add(getJPanel3(), null);
			jPanel2.add(getJTextFieldResource(), null);
		}
		return jPanel2;
	}

	/**
	 * This method initializes jTextFieldDescription	
	 * 	
	 * @return javax.swing.JTextField	
	 */
	private JTextField getJTextFieldDescription() {
		if (jTextFieldDescription == null) {
			jTextFieldDescription = new JTextField();
			jTextFieldDescription.setPreferredSize(new Dimension(200, 20));
		}
		return jTextFieldDescription;
	}

	/**
	 * This method initializes jPanel6	
	 * 	
	 * @return javax.swing.JPanel	
	 */
	private JPanel getJPanel6() {
		if (jPanel6 == null) {
			FlowLayout flowLayout4 = new FlowLayout();
			flowLayout4.setVgap(7);
			flowLayout4.setAlignment(FlowLayout.LEFT);
			flowLayout4.setHgap(0);
			jPanel6 = new JPanel();
			jPanel6.setPreferredSize(new Dimension(100, 30));
			jPanel6.setLayout(flowLayout4);
			jPanel6.add(jLabel1, null);
		}
		return jPanel6;
	}

	/**
	 * This method initializes jPanel3	
	 * 	
	 * @return javax.swing.JPanel	
	 */
	private JPanel getJPanel3() {
		if (jPanel3 == null) {
			FlowLayout flowLayout = new FlowLayout();
			flowLayout.setHgap(0);
			flowLayout.setAlignment(FlowLayout.LEFT);
			jPanel3 = new JPanel();
			jPanel3.setPreferredSize(new Dimension(100, 30));
			jPanel3.setLayout(flowLayout);
			jPanel3.add(jLabel, null);
		}
		return jPanel3;
	}

	/**
	 * This method initializes jPanel21	
	 * 	
	 * @return javax.swing.JPanel	
	 */
	private JPanel getJPanel21() {
		if (jPanel21 == null) {
			FlowLayout flowLayout21 = new FlowLayout();
			flowLayout21.setVgap(0);
			flowLayout21.setAlignment(FlowLayout.LEFT);
			jPanel21 = new JPanel();
			jPanel21.setPreferredSize(new Dimension(130, 30));
			jPanel21.setLayout(flowLayout21);
			jPanel21.add(getJPanel31(), null);
			jPanel21.add(getJTextFieldSign(), null);
		}
		return jPanel21;
	}

	/**
	 * This method initializes jPanel31	
	 * 	
	 * @return javax.swing.JPanel	
	 */
	private JPanel getJPanel31() {
		if (jPanel31 == null) {
			jLabel2 = new JLabel();
			jLabel2.setText("signatur");
			FlowLayout flowLayout3 = new FlowLayout();
			flowLayout3.setHgap(0);
			flowLayout3.setAlignment(FlowLayout.LEFT);
			jPanel31 = new JPanel();
			jPanel31.setPreferredSize(new Dimension(100, 30));
			jPanel31.setLayout(flowLayout3);
			jPanel31.add(jLabel2, null);
		}
		return jPanel31;
	}

	/**
	 * This method initializes jTextFieldSign	
	 * 	
	 * @return javax.swing.JTextField	
	 */
	private JTextField getJTextFieldSign() {
		if (jTextFieldSign == null) {
			jTextFieldSign = new JTextField();
			jTextFieldSign.setPreferredSize(new Dimension(100, 20));
			jTextFieldSign.setText("");
		}
		return jTextFieldSign;
	}

	/**
	 * This method initializes jPanel22	
	 * 	
	 * @return javax.swing.JPanel	
	 */
	private JPanel getJPanel22() {
		if (jPanel22 == null) {
			FlowLayout flowLayout22 = new FlowLayout();
			flowLayout22.setVgap(0);
			flowLayout22.setAlignment(FlowLayout.LEFT);
			jPanel22 = new JPanel();
			jPanel22.setPreferredSize(new Dimension(130, 30));
			jPanel22.setLayout(flowLayout22);
			jPanel22.add(getJPanel32(), null);
			jPanel22.add(getJTextFieldDate(), null);
		}
		return jPanel22;
	}

	/**
	 * This method initializes jPanel32	
	 * 	
	 * @return javax.swing.JPanel	
	 */
	private JPanel getJPanel32() {
		if (jPanel32 == null) {
			jLabel3 = new JLabel();
			jLabel3.setText("Datum");
			FlowLayout flowLayout5 = new FlowLayout();
			flowLayout5.setHgap(0);
			flowLayout5.setAlignment(FlowLayout.LEFT);
			jPanel32 = new JPanel();
			jPanel32.setPreferredSize(new Dimension(100, 30));
			jPanel32.setLayout(flowLayout5);
			jPanel32.add(jLabel3, null);
		}
		return jPanel32;
	}

	/**
	 * This method initializes jTextFieldDate	
	 * 	
	 * @return javax.swing.JTextField	
	 */
	private JTextField getJTextFieldDate() {
		if (jTextFieldDate == null) {
			jTextFieldDate = new JTextField();
			jTextFieldDate.setPreferredSize(new Dimension(100, 20));
			jTextFieldDate.setText("YYYY-MM-DD");
		}
		return jTextFieldDate;
	}

	/**
	 * This method initializes jPanel23	
	 * 	
	 * @return javax.swing.JPanel	
	 */
	private JPanel getJPanel23() {
		if (jPanel23 == null) {
			FlowLayout flowLayout23 = new FlowLayout();
			flowLayout23.setVgap(0);
			flowLayout23.setAlignment(FlowLayout.LEFT);
			jPanel23 = new JPanel();
			jPanel23.setPreferredSize(new Dimension(130, 30));
			jPanel23.setLayout(flowLayout23);
			jPanel23.add(getJPanel33(), null);
			jPanel23.add(getJTextFieldTime(), null);
		}
		return jPanel23;
	}

	/**
	 * This method initializes jPanel33	
	 * 	
	 * @return javax.swing.JPanel	
	 */
	private JPanel getJPanel33() {
		if (jPanel33 == null) {
			jLabel4 = new JLabel();
			jLabel4.setText("Tid");
			FlowLayout flowLayout6 = new FlowLayout();
			flowLayout6.setHgap(0);
			flowLayout6.setAlignment(FlowLayout.LEFT);
			jPanel33 = new JPanel();
			jPanel33.setPreferredSize(new Dimension(100, 30));
			jPanel33.setLayout(flowLayout6);
			jPanel33.add(jLabel4, null);
		}
		return jPanel33;
	}

	/**
	 * This method initializes jTextFieldTime	
	 * 	
	 * @return javax.swing.JTextField	
	 */
	private JTextField getJTextFieldTime() {
		if (jTextFieldTime == null) {
			jTextFieldTime = new JTextField();
			jTextFieldTime.setPreferredSize(new Dimension(100, 20));
			jTextFieldTime.setText("HH.MM");
		}
		return jTextFieldTime;
	}

	/**
	 * This method initializes jPanel11	
	 * 	
	 * @return javax.swing.JPanel	
	 */
	private JPanel getJPanel11() {
		if (jPanel11 == null) {
			FlowLayout flowLayout11 = new FlowLayout();
			flowLayout11.setHgap(5);
			flowLayout11.setAlignment(FlowLayout.LEFT);
			flowLayout11.setVgap(0);
			jPanel11 = new JPanel();
			jPanel11.setPreferredSize(new Dimension(130, 30));
			jPanel11.setLayout(flowLayout11);
			jPanel11.add(getJPanel61(), null);
			jPanel11.add(getJButton(), null);
		}
		return jPanel11;
	}

	/**
	 * This method initializes jPanel61	
	 * 	
	 * @return javax.swing.JPanel	
	 */
	private JPanel getJPanel61() {
		if (jPanel61 == null) {
			FlowLayout flowLayout41 = new FlowLayout();
			flowLayout41.setHgap(0);
			flowLayout41.setAlignment(FlowLayout.LEFT);
			flowLayout41.setVgap(7);
			jPanel61 = new JPanel();
			jPanel61.setPreferredSize(new Dimension(100, 30));
			jPanel61.setLayout(flowLayout41);
		}
		return jPanel61;
	}

	/**
	 * This method initializes jPanel	
	 * 	
	 * @return javax.swing.JPanel	
	 */
	private JPanel getJPanel() {
		if (jPanel == null) {
			jPanel = new JPanel();
			jPanel.setLayout(new GridBagLayout());
		}
		return jPanel;
	}

	/**
	 * This method initializes jButton	
	 * 	
	 * @return javax.swing.JButton	
	 */
	private JButton getJButton() {
		if (jButton == null) {
			jButton = new JButton();
			jButton.setText("Boka");
			jButton.addActionListener(new java.awt.event.ActionListener() {
				public void actionPerformed(java.awt.event.ActionEvent e) {
					vControler.newBooking(	jTextFieldDescription.getText(), 
											jTextFieldResource.getText(), 
											jTextFieldSign.getText(), 
											jTextFieldTime.getText(), 
											jTextFieldDate.getText());
									}
			});
		}
		return jButton;
	}

}  //  @jve:decl-index=0:visual-constraint="10,10"
